import { ApiProperty } from "@nestjs/swagger";
import { HotList } from "@prisma/client";
import { Transform } from "class-transformer";
import { IsInt, IsNotEmpty, IsString, Min } from "class-validator";

import { DbCommonField } from "@/core/types/db-common-field.type";

export class CreateHotlistDto implements CustomOmit<HotList, "id" | "isPinned" | DbCommonField> {
    @Transform(({ value }) => value.trim())
    @IsString()
    @IsNotEmpty()
    @ApiProperty({ description: "名称", example: "核聚变成功", required: true })
    title: string;

    @Transform(({ value }) => Number(value))
    @IsInt()
    @Min(0)
    @ApiProperty({ description: "热度分", example: 0, required: false })
    hotScore: number;
}
